<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "crm_system_ygxx".
 *
 * @property int $id
 * @property string $ygmc 员工名称
 * @property string $yggh 员工工号
 * @property string $zxhm 坐席号码
 * @property string $lxdh 联系电话
 * @property string $xb 性别
 * @property string $sfzh 身份证号
 * @property array $dlxl 大类小类
 * @property array $dlxl_ 大类小类名称
 * @property string $bz 备注
 * @property int $user_id 用户
 * @property string $username 用户名
 * @property array $config_souye 配置首页模块
 * @property array $config_other 配置员工目标以及其他等配置
 *
 * @property User $user
 */
class CrmSystemYgxx extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'crm_system_ygxx';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['dlxl', 'dlxl_', 'config_souye', 'config_other'], 'safe'],
            [['user_id'], 'integer'],
            [['ygmc', 'yggh'], 'string', 'max' => 40],
            [['zxhm', 'lxdh', 'xb', 'sfzh'], 'string', 'max' => 20],
            [['bz', 'username'], 'string', 'max' => 255],
            [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'ygmc' => '员工名称',
            'yggh' => '员工工号',
            'zxhm' => '坐席号码',
            'lxdh' => '联系电话',
            'xb' => '性别',
            'sfzh' => '身份证号',
            'dlxl' => '大类小类',
            'dlxl_' => '大类小类名称',
            'bz' => '备注',
            'user_id' => '用户',
            'username' => '用户名',
            'config_souye' => '配置首页模块',
            'config_other' => '配置员工目标以及其他等配置',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(User::className(), ['id' => 'user_id']);
    }
}
